/**
 * Author:   YASUO
 * Date:     2018/7/11 14:21
 * Description:
 */
package com.rljk.common.consts;

import com.rljk.common.result.CodeMsg;
import com.rljk.exception.GlobalException;

/**
 * 积分
 */
public enum IntegralEnum {

    AUTHENTICATION(1,"个人认证",20),
    DAY_SIGN(2,"签到评测",10),
    WECHAT(3,"微信公众号",5),
    TASK_INTERACT(4,"任务互动",10),
    STUDY(5,"学习能力",10),
    SHOPPING(6,"购物互动",10),
    PUBLISH_TASK(7,"发布任务",5),
    MINER_ACTIVE(8,"星我矿机ID激活",10),
    ACTIVE_INTERACT(9,"活动互动",10),
    OPINION(10,"意见反馈",5),
    SHARE(11,"推广分享",5)
    ;

    private int code;
    private String name;
    private int socre;

    IntegralEnum(int code, String name, int socre) {
        this.code = code;
        this.name = name;
        this.socre = socre;
    }

    public static String getName(int code) {
        for (IntegralEnum c : IntegralEnum.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        throw new GlobalException(CodeMsg.ENUM_NOT_FIND);
    }

    public static int getScore(int code) {
        for (IntegralEnum c : IntegralEnum.values()) {
            if (c.getCode() == code) {
                return c.getSocre();
            }
        }
        throw new GlobalException(CodeMsg.ENUM_NOT_FIND);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSocre() {
        return socre;
    }

    public void setSocre(int socre) {
        this.socre = socre;
    }
}
